<!DOCTYPE html>
<html >
    <head>
        <meta charset="UTF-8">
        <title>第一题</title>
        <script>
            window.onload = function () {
                //第一题
                document.getElementById('btn1').onclick = function () {
                    var    arr   =    [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
                    var sum = 0;
                    for(var i = 0, len = arr.length; i < len; i++){
                        sum += arr[i];
                    }
                    alert(sum);
                };
            };
        </script>
    </head>
    <body>
       <div>
           1: 已知数组，求数组之和？
       </div>
        <div>代码示例</div>
        <div style="border: 1px solid #c1bec0;">
            <pre>
               document.getElementById('btn1').onclick = function () {
                    var    arr   =    [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
                    var sum = 0;
                    for(var i = 0, len = arr.length; i < len; i++){
                        sum += arr[i];
                    }
                    alert(sum);
                };

            </pre>

        </div>
       <div>代码结果</div>
       <div style="height:60px;line-height:60px;border: 1px solid #c1bec0;">
           <button id="btn1">点击查看效果</button>
       </div>
    </body>
</html>